package com.vdm.action;

import com.vdm.model.AmountInfo;
import com.vdm.service.AmountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("amount")
public class AmountController {

    @Autowired
    AmountService amountService;

    @RequestMapping("toAmountList")
    public String toAmountList(){
        return "amount/amountList";
    }

    @RequestMapping("amountList")
    @ResponseBody
    public Object amountList(){
        List<AmountInfo> amountList = amountService.amountInfoList();
        int count = amountService.getAmountInfoCount();
        Map<String,Object> retMap = new HashMap();
        retMap.put("code",0);
        retMap.put("msg","");
        retMap.put("count",count);
        retMap.put("data",amountList);
        return retMap;
    }

}
